public class test628 {
    public static boolean isPrime(long num) {
        if (num <= 1) return false;
        if (num == 2) return true;
        if (num % 2 == 0) return false;
        for (long i = 3; i <= Math.sqrt(num); i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println("p\t2^p - 1");
        for (int p = 2; p <= 31; p++) {
            long mersenne = (long) Math.pow(2, p) - 1;
            if (isPrime(mersenne)) {
                System.out.println(p + "\t" + mersenne);
            }
        }
    }
}
